function confirmDelete(name,deleid,rempagenow,remsearch,rows,lastpage) {
	if(window.confirm("确定删除用户 "+name+"?")){
		if((rows-1)%3==0 && rempagenow==lastpage) rempagenow-=1;
		location.href="../public/userList.php?action=delete&delid="+deleid+"&delname="+name+"&pagenow="+rempagenow+"&searchvalue"+remsearch;
	}else {
		location.href="../public/userList.php?pagenow="+rempagenow+"&searchvalue"+remsearch;
	}
}

function confirmLock(name,lockid,rempagenow,remsearch) {
	if(window.confirm("确定封禁用户 "+name+"?")){
		location.href="../public/userList.php?action=lock&lockid="+lockid+"&lockname="+name+"&pagenow="+rempagenow+"&searchvalue"+remsearch;
	}else {
		location.href="../public/userList.php?pagenow="+rempagenow+"&searchvalue"+remsearch;
	}
}

function confirmLogin() {
	if(window.confirm("确定注销登录?")){
		location.href="../public/logout.php";
	}
}

//选择图片前预览
function browseUploadImg(obj) {
	var file = obj.files[0];
	var reader = new FileReader();
	reader.onload = function (e) {
		var img = document.getElementById("imgbox");
		img.style.backgroundImage =  "url("+e.target.result+")" ;
	}
	reader.readAsDataURL(file)
}
//清空图片前预览
function cleanbrowseUploadImg(place){
	if(place==0){
		location.href="./personInfo.php?action=editPicInfo";
	}else if(place==1){
		location.href="";
	}
}

//遍历数组
function getMessageList(){
	var date = document.getElementsByName("messBoxList");
	check_val = [];
	for(k in date){
		if(date[k].checked){
			check_val.push(date[k].value);
		}
	}
	return check_val;
}

//回复、转发操作转向
function SignActionMessage(action){
	if(action=='reply'){
		location.href="./sendmess.php?action=reply&dealwitharray="+getMessageList().pop();
	}else if(action=='forward'){
		location.href="./sendmess.php?action=forward&dealwitharray="+getMessageList().pop();
	}
}

//标记已读未读删除操作转向
function mulActionMessage(action,rows,lastpage){
	if(action=='read'){
		location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=read&dealwitharray="+getMessageList();
	}else if(action=='unread'){
		location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=unread&dealwitharray="+getMessageList();
	}else if(action=='move'){
		if(window.confirm("删除会取消该消息收藏，确定删除?")){
			location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=move&dealwitharray="+getMessageList();
		}
	}else if(action=='back'){
		location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=back&dealwitharray="+getMessageList();
	}
}
//清除草稿与回收站消息
function mulActionDelMessage(action,mid,rows,lastpage){
	if(mid==null){
		if(window.confirm("清除后该消息将不会出现，确定清除该信息?")){
			location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=del&deltype=trash&dealwitharray="+getMessageList();
		}
	}else{
		if(window.confirm("确定删除此草稿信息?")){
			location.href="./messaction.php?rows="+rows+"&lastpage="+lastpage+"&action=del&deltype=save&dealwitharray="+mid;
		}
	}
}
//详情页删除消息
function actMessDetail(action,mid){
	if(window.confirm("删除会取消该消息收藏，确定删除?")){
		location.href="./browsemess.php?action=move&dealwitharray="+mid;
	}
}

//登录/开发提示
function loginTips(flag){
	if(flag){
		alert('前台 账号:11110000 密码:123123\n后台 账号:10101010 密码:123456\n请务必使用高版本谷歌浏览器浏览，否则样式有所影响！');
	}else{
		alert('好的功能需要足够时间去琢磨！');
	}
}